"use strict";
cc._RF.push(module, 'cddb0rUGjxMa7bZ5dpNN+Oo', 'peopleArcherySynthPage');
// scripts/Game/Page/peopleArcherySynthPage.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../engines/gameEngine");
var CsvFileKind_1 = require("../../engines/libs/CsvFileKind");
var PageBase_1 = require("../Base/PageBase");
var MainRoot_1 = require("../MainRoot");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var peopleArcherySynthPage = /** @class */ (function (_super) {
    __extends(peopleArcherySynthPage, _super);
    function peopleArcherySynthPage() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.showNode = null;
        _this.lbName = null;
        _this.lbParam = null;
        _this.lbSynth = null;
        _this.weaponId = "";
        _this.level = null;
        _this.oneWeaponId = "";
        _this.twoWeaponId = "";
        return _this;
    }
    peopleArcherySynthPage.prototype.bindLevel = function (level, weaponId, oneWeaponId, twoWeaponId) {
        this.weaponId = weaponId;
        this.oneWeaponId = oneWeaponId;
        this.twoWeaponId = twoWeaponId;
        this.level = level;
        this.loadPage();
    };
    peopleArcherySynthPage.prototype.loadPage = function () {
        var data = gameEngine_1.default.getManagers().csvDataManager.getCsvDataItem(CsvFileKind_1.CsvFileKind.CsvFile.peopleArcheryMagicWeapon, this.weaponId);
        var oneData = gameEngine_1.default.getManagers().csvDataManager.getCsvDataItem(CsvFileKind_1.CsvFileKind.CsvFile.peopleArcheryMagicWeapon, this.oneWeaponId);
        var twoData = gameEngine_1.default.getManagers().csvDataManager.getCsvDataItem(CsvFileKind_1.CsvFileKind.CsvFile.peopleArcheryMagicWeapon, this.twoWeaponId);
        var sp = this.showNode.getComponent(cc.Sprite);
        var iconPath = data["icon_path"];
        var name = data["name"];
        this.lbName.string = name;
        this.lbSynth.string = oneData["name"] + "+" + twoData["name"];
        this.lbParam.string = "";
        var param = data["param"];
        var pAry = param.split("&");
        var typeAry = [];
        var paramAry = [];
        pAry.forEach(function (p) {
            var strAry = p.split("|");
            typeAry.push(strAry["0"]);
            paramAry.push(Number(strAry["1"]));
        });
        for (var i = 0; i < pAry.length; i++) {
            var data_1 = { param_type: typeAry[i], option_param: paramAry[i] };
            var chat = gameEngine_1.default.getManagers().peopleArcheryManager.getOptionText(data_1);
            this.lbParam.string += chat + (i == 0 ? "\n" : "");
        }
        MainRoot_1.default.LevelSystem.getOneTypeBundle(this.level.getLevelInfo().levelType).load("selectWeapon/" + iconPath, cc.SpriteFrame, function (err, spf) {
            if (err) {
                console.log("加载道具icon失败", err);
                return;
            }
            sp.spriteFrame = spf;
        });
    };
    peopleArcherySynthPage.prototype.update = function (dt) {
        this.level.gamePauseFlag = true;
    };
    peopleArcherySynthPage.prototype.onDestroy = function () {
        this.level.gamePauseFlag = false;
    };
    __decorate([
        property({ type: cc.Node, tooltip: "展示图片" })
    ], peopleArcherySynthPage.prototype, "showNode", void 0);
    __decorate([
        property({ type: cc.Label, tooltip: "武器名字" })
    ], peopleArcherySynthPage.prototype, "lbName", void 0);
    __decorate([
        property({ type: cc.Label, tooltip: "属性文本" })
    ], peopleArcherySynthPage.prototype, "lbParam", void 0);
    __decorate([
        property({ type: cc.Label, tooltip: "合成文本" })
    ], peopleArcherySynthPage.prototype, "lbSynth", void 0);
    peopleArcherySynthPage = __decorate([
        ccclass
    ], peopleArcherySynthPage);
    return peopleArcherySynthPage;
}(PageBase_1.default));
exports.default = peopleArcherySynthPage;

cc._RF.pop();